﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace TestOnlineProject.Models.Entities
{
    [MetadataType(typeof(Subject.Metadata))]
    public partial class Subject
    {
        private sealed class Metadata
        {
            [Required(ErrorMessage = "The Code is required.")]
            [StringLength(10, MinimumLength = 2, ErrorMessage = "The Code length is 2-10 characters.")]
            public string Code { get; set; }

            [Required(ErrorMessage = "The Name is required.")]
            [StringLength(100, MinimumLength = 3, ErrorMessage = "The Name length is 3-100 characters.")]
            public string Name { get; set; }
        }
    }

    [MetadataType(typeof(Section.Metadata))]
    public partial class Section
    {
        private sealed class Metadata
        {
            [Required(ErrorMessage = "The Name is required.")]
            [StringLength(100, MinimumLength = 5, ErrorMessage = "The Section length is 5-100 characters.")]
            public string Name { get; set; }
        }
    }

    [MetadataType(typeof(User.Metadata))]
    public partial class User
    {
        private sealed class Metadata
        {
            [Required(ErrorMessage = "The Username is required.")]
            [RegularExpression(@"[a-z0-9]{4,20}", ErrorMessage = "The Username length is 4-20 characters, letters and numbers only.")]
            public string Username { get; set; }

            [Required(ErrorMessage = "The Password is required.")]
            [StringLength(50, MinimumLength = 6, ErrorMessage = "The Password length is 6-50 characters.")]
            public string Password { get; set; }

            [Required(ErrorMessage = "The E-Mail is required.")]
            [RegularExpression(@"^(\w+[\.\-])*\w+@(\w+\.)+[A-Za-z]+$", ErrorMessage = "The E-Mail like example@abc.com and the length is less than or equal to 50 chatacters.")]
            public string Email { get; set; }

            [Required(ErrorMessage = "The Full Name is required.")]
            [StringLength(50, MinimumLength = 5, ErrorMessage = "The Full Name length is 5-50 characters.")]
            public string FullName { get; set; }

            [Required(ErrorMessage = "The Role is required.")]
            public string RoleId { get; set; }
        }
    }

    [MetadataType(typeof(Feedback.Metadata))]
    public partial class Feedback
    {
        private sealed class Metadata
        {
            [Required(ErrorMessage = "The Title is required.")]
            [StringLength(100, MinimumLength = 5, ErrorMessage = "The Title length is 5-100 characters.")]
            public string Title { get; set; }

            [Required(ErrorMessage = "The Content is required.")]
            [StringLength(500, MinimumLength = 5, ErrorMessage = "The Content length is 5-500 characters.")]
            public string Content { get; set; }
        }
    }

    [MetadataType(typeof(Participant.Metadata))]
    public partial class Participant
    {
        private sealed class Metadata
        {
            [Required(ErrorMessage = "The User is required.")]
            public string UserId { get; set; }
        }
    }
}